﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySql.Data.MySqlClient;
using System.Data;

namespace PropertyManagement.tousu
{
    public partial class addTouSu : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string sname, stime, content, status, person;
            int n;

            sname = txtsname.Text;
            stime = txtstime.Text;
            content = txtcontent.Text;
            status = RadioButtonList1.SelectedValue;
            person = txtperson.Text;

            string strsql = "insert into stousu(sname, stime, content, sstatus, person) values("
            + "'" + sname + "',"
            + "'" + stime + "',"
            + "'" + content + "',"
            + "'" + status + "',"
            + "'" + person + "'"
            + ")";

            mydata myda = new mydata();
            n = myda.execSql(strsql);
            if (n > 0)
            {
                Response.Write("<script language=javascript> alert('添加数据成功') </script>");
            }
            else
            {
                Response.Write("<script language=javascript> alert('添加数据失败') </script>");
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("browerTouSu.aspx");
        }

        protected void Button4_Click(object sender, EventArgs e)
        {
            Response.Redirect("selectTouSu.aspx");
        }
    }
}